<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改会长商城产品规格')" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-agentPartsAttribute-edit" th:object="${zsyhAgentPartsattribute}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">属性名称：</label>
                <div class="col-sm-8">
                    <input name="attributeName" th:field="*{attributeName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">排序 排序数字越大，排序约靠前：</label>
                <div class="col-sm-8">
                    <input name="attributeSort" th:field="*{attributeSort}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">销售价：</label>
                <div class="col-sm-8">
                    <input name="attributeSalePrice" th:field="*{attributeSalePrice}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">补助金有效期/质保期单位：月 ：</label>
                <div class="col-sm-8">
                    <input name="attributeWarranty" th:field="*{attributeWarranty}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">二维码有效期 单位：月：</label>
                <div class="col-sm-8">
                    <input name="attributeInstall" th:field="*{attributeInstall}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">质保期内损坏 赔付金额：</label>
                <div class="col-sm-8">
                    <input name="attributePayPrice" th:field="*{attributePayPrice}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">配件id：</label>
                <div class="col-sm-8">
                    <input name="partsId" th:field="*{partsId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">质保期单位：月 产品质保期：</label>
                <div class="col-sm-8">
                    <input name="attributeFreeWarranty" th:field="*{attributeFreeWarranty}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">属性备注：</label>
                <div class="col-sm-8">
                    <textarea name="attributeRemarks" class="form-control">[[*{attributeRemarks}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">属性logo：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="attributeLogo" th:field="*{attributeLogo}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="attributeLogo" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否包邮 1包邮 ：</label>
                <div class="col-sm-8">
                    <select name="isPost" class="form-control m-b" th:with="type=${@dict.getType('zsyh_yesno')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isPost}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否上架：</label>
                <div class="col-sm-8">
                    <select name="isShow" class="form-control m-b" th:with="type=${@dict.getType('zsyh_yesno')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isShow}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">建议零售价：</label>
                <div class="col-sm-8">
                    <input name="attributeRetailPrice" th:field="*{attributeRetailPrice}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">产品优势描述：</label>
                <div class="col-sm-8">
                    <textarea name="attributeAdvantage" class="form-control">[[*{attributeAdvantage}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">产品使用说明书：</label>
                <div class="col-sm-8">
                    <textarea name="attributeInstructions" class="form-control">[[*{attributeInstructions}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "zsyh/agentPartsAttribute";
        $("#form-agentPartsAttribute-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-agentPartsAttribute-edit').serialize());
            }
        }

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx + 'common/uploadOSS',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>